import * as dat from 'dat.gui'
import * as THREE from 'three'

const gui = new dat.GUI()


export const guiMove = (obj) => {
    gui.add(obj.position, 'x', -1, 1, 0.01).name('位移x')
    gui.add(obj.position, 'y', -1, 1, 0.01).name('位移y')
    gui.add(obj.position, 'z', -1, 1, 0.01).name('位移z')

    gui.add(obj.rotation, 'x', 0, 2 * Math.PI, 0.01).name('旋转x')
    gui.add(obj.rotation, 'y', 0, 2 * Math.PI, 0.01).name('旋转y')
    gui.add(obj.rotation, 'z', 0, 2 * Math.PI, 0.01).name('旋转z')
}

export const guiChangeColor = (texture) => {
    gui.add(texture, 'colorSpace', {
        sRGB: THREE.SRGBColorSpace,
        linear: THREE.LinearSRGBColorSpace
    }).onChange(() => {
        texture.needsUpdate = true
    })
}